package kuzmenkov.oip.service;

import kuzmenkov.oip.service.impl.ParameterItem;

import java.util.List;
import java.util.Locale;

/**
 * The service interface, with spring bean configuration the corresponding
 * service methods are exposed to client calling. Also it serves the imaging controller
 * User: Kuzmenkov
 * Date: 08.03.2009
 * Time: 13:34:48
 */
public interface ImageProcessingService {

    /**
     * A path to a common temp directory
     */
    String COMMON_TEMP_DIR = "temp";

    // these properties are used into a database
    String PARAM_TYPE = "type";
    String PARAM_NAME = "name";
    String PARAM_DESCRIPTION = "description";
    String PARAM_IS_RESULT = "isResult";
    String PARAM_POSITION = "position";
    String PARAM_DEFAULT_VALUE = "defaultValue";


    String IMAGE_FILE_PATH = "filePath";

    /**
     * Returns a current locale of a site
     * @return
     */
    Locale getLocale() throws Exception;

    /**
     * Test method. NOT USED!!
     * @param input
     * @return
     */
    String getResult(String input); //todo

    /**
     * Returns parameters of a current module. The elements of the list implement
     * the interface Map<String,Object>. Possible keys: "name", "description", "type",
     * "isResult", "defaultValue", "position" (see above)
     * @return
     */
    List getParameters() throws Exception;

    /**
     * Returns images for a current module. Elements of list implement Map<String,Object>
     * For example, one of possible keys: "filePath"
     * @return list of properties of the images
     */
    List getImages() throws Exception;


    /**
     * Runs the image processing
     * @param params the input parameters
     * @return the output parameters
     */    
    Object[] process(Object[] params) throws Exception;

    /**
     *
     * @return name of a current module. If there isn't any  selected module it
     * returns null. 
     */
    String getModuleName() throws Exception;

    /**
     *
     * @return name of a producer of a current module. If there isn't any
     * selected module it returns null
     */
    String getModuleProducerName() throws Exception;

    /**
     * 
     * @return a width of a panel which contains an UI of a current module 
     */
    int getPanelWidth() throws Exception;

    /**
     *
     * @return a height of a panel which contains an UI of a current module 
     */
    int getPanelHeight() throws Exception;

    /**
     * 
     * @return parameters of  a current module
     * @throws Exception
     */
    List<ParameterItem> getParameterItems () throws Exception ;

    /**
     * 
     * @return a full name of an adapter class
     */
    String getModuleAdapterClass() throws Exception;
}
